/*
 * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @Date: 2023-12-30 08:39:48
 * @LastEditors: 嗷嗷呟 2791877973@qq.com
 * @LastEditTime: 2024-01-03 18:36:24
 * @FilePath: \web课堂\ShiXun1\vue-admin-main\src\api\enterprise.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/utils/request'

/**
 * 获取企业列表
 * @param { page, pageSize} params
 * @returns
 */
export function getEnterpriseListAPI(params) {
    return request({
        url: '/park/enterprise',
        params
    })
}

/**
 * 删除企业
 * @param {*} id
 * @returns
 */
export function delExterpriseAPI(id) {
    return request({
        url: `/park/enterprise/${id}`,
        method: 'DELETE'
    })
}

/**
* 获取行业列表
* @returns
*/
export function getIndustryListAPI() {
    return request({
        url: '/park/industry'
    })
}

/**
* 上传合同
* @returns
*/
export function uploadAPI(data) {
    return request({
        url: '/upload',
        method: 'POST',
        data
    })
}

export function createExterpriseAPI(data) {
    return request({
        url: '/park/enterprise',
        method: 'POST',
        data
    })
}

/**
 * 获取详情
 * @param {企业id} id
 * @returns
 */

export function getEnterpriseDetail(id) {
    return request({
        url: `/park/enterprise/${id}`,
        method: 'GET'
    })
}

export function getRentBuildListAPI() {
    return request({
        url: '/park/rent/building'
    })
}

/**
 * 创建合同
 * @param {*}
 * @returns
 */
export function createRentAPI(data) {
    return request({
        url: '/park/enterprise/rent',
        method: 'POST',
        data
    })
}

/**
* 更新企业
* @param {*} data
* @returns
*/
export function updateExterpriseAPI(data) {
    return request({
        url: '/park/enterprise',
        method: 'PUT',
        data
    })
}

/**
* 获取合同列表
* @param {*} id
* @returns
*/
export function getRentListAPI(id) {
    return request({
        url: `/park/enterprise/rent/${id}`
    })
}

/**
 * 退租
 * @param {合同id} rentId
 * @returns
 */

export function outRentAPI(rentId) {
    return request({
      url: `/park/enterprise/rent/${rentId}`,
      method: 'PUT'
    })
  }

  export function delRentAPI(rentId) {
    return request({
      url: `/park/enterprise/rent/${rentId}`,
      method: 'DELETE'
    })
  }